@extends('layouts.default')

@section('title')
    {{{ $user->name }}} {{ lang('Charge Point') }}_@parent
@stop

@section('content')

    <div class="users-show row">

        <div class="col-md-3">
            @include('users.partials.basicinfo')
        </div>

        <div class="main-col col-md-9 left-col">

            <ol class="breadcrumb">
                <li><a href="{{ route('users.show', $user->id) }}">个人中心</a></li>
                <li class="active">剩余D币（{{$remain_dcoin}}）</li>
            </ol>


            <div class="alert alert-warning">
                本站的D币来源：<br>
                赞助得D币：可在个人中心->充D币,通过微信或支付宝扫码进行赞助，赞助1元=1个D币，扫码时请注明赞助,最多5分钟后D币到账；<br>
                充值D币操作说明：先点击上边的D币值，然后扫码进行充值（默认充值 10 D币）
            </div>
            <div id='msg_tip' class="alert alert-info" style="display: none">

            </div>
            <div class="panel panel-default text-center">
                <div class="panel-body">
                    {{--<!-- <div class="main-col col-md-2">--}}
                        {{--<div class="list-group">--}}
                            {{--<a href="javascript:void(0)" onclick="make_qr_img('{{ route('users.make_charge_qr', ['id' => $user->id,'price' => 10, 'type' => $payment_type ]) }}')" class="list-group-item " style="margin-top: 10px;background-color: #86ADD4;color:#fff;">10 D币</a>--}}
                            {{--<a href="javascript:void(0)" onclick="make_qr_img('{{ route('users.make_charge_qr', ['id' => $user->id,'price' => 30, 'type' => $payment_type ]) }}')" class="list-group-item" style="margin-top: 3px;background-color: #86ADD4;color:#fff;">30 D币</a>--}}
                            {{--<a href="javascript:void(0)" onclick="make_qr_img('{{ route('users.make_charge_qr', ['id' => $user->id,'price' => 50, 'type' => $payment_type ]) }}')" class="list-group-item" style="margin-top: 3px;background-color: #86ADD4;color:#fff;">50 D币</a>--}}
                            {{--<a href="javascript:void(0)" onclick="make_qr_img('{{ route('users.make_charge_qr', ['id' => $user->id,'price' => 100, 'type' => $payment_type ]) }}')" class="list-group-item" style="margin-top: 3px;background-color: #86ADD4;color:#fff;">100 D币</a>--}}
                            {{--<a href="javascript:void(0)" onclick="make_qr_img('{{ route('users.make_charge_qr', ['id' => $user->id,'price' => 200, 'type' => $payment_type ]) }}')" class="list-group-item" style="margin-top: 3px;background-color: #86ADD4;color:#fff;">200 D币</a>--}}
                        {{--</div>--}}
                    {{--</div> -->--}}
					{{--<div style="width:100%;margin:20px 0px;">--}}
					        {{--<a href="javascript:void(0)" onclick="make_qr_img('{{ route('users.make_charge_qr', ['id' => $user->id,'price' => 10, 'type' => $payment_type ]) }}',10)"  class="dcoin_price" id="10">10 D币</a>--}}
                            {{--<a href="javascript:void(0)" onclick="make_qr_img('{{ route('users.make_charge_qr', ['id' => $user->id,'price' => 30, 'type' => $payment_type ]) }}',30)"  class="dcoin_price" id="30">30 D币</a>--}}
                            {{--<a href="javascript:void(0)" onclick="make_qr_img('{{ route('users.make_charge_qr', ['id' => $user->id,'price' => 50, 'type' => $payment_type]) }}',50)"  class="dcoin_price" id="50">50 D币</a>--}}
                            {{--<a href="javascript:void(0)" onclick="make_qr_img('{{ route('users.make_charge_qr', ['id' => $user->id,'price' => 100, 'type' => $payment_type]) }}',100)" class="dcoin_price" id="100">100 D币</a>--}}
                            {{--<a href="javascript:void(0)" onclick="make_qr_img('{{ route('users.make_charge_qr', ['id' => $user->id,'price' => 200, 'type' => $payment_type]) }}',200)" class="dcoin_price" id="200">200 D币</a>--}}
					{{--</div>--}}

                    {{--<div class="main-col col-md-4" style="margin-left:33%">--}}

                        {{--<img id='qr_img' src="{{$qr_img}}" alt="" width="250" style="border: 2px solid #e4e4e4;border-radius: 4px;margin-bottom: 18px;">--}}
                        {{--<div id='qr_price' class="alert alert-warning">--}}
                        {{--赞助 {{$price}} 元--}}
                        {{--</div>--}}
                    {{--</div>--}}

                    <div class="main-col col-md-offset-1 col-md-4">

                        <img src="{{get_cdn_domain()}}/uploads/images/weixin-zanzhu.jpg?imageView2/2/w/1240/h/0" alt="" width="250" style="border: 2px solid #e4e4e4;border-radius: 4px;margin-bottom: 18px;">
                        <div class="alert alert-info">
                            微信赞助
                        </div>
                    </div>
                    <div class="main-col col-md-offset-1 col-md-4">

                        <img src="{{get_cdn_domain()}}/uploads/images/zhifubao-zanzhu.jpg?imageView2/2/w/1240/h/0" alt="" width="250" style="border: 2px solid #e4e4e4;border-radius: 4px;margin-bottom: 18px;">
                        <div class="alert alert-info">
                            支付宝赞助
                        </div>
                    </div>


                </div>

            </div>
        </div>
    </div>

@stop

@section('scripts')
    <script language="JavaScript" type="application/javascript">
        {{--var payment_id = {{$payment_id}};--}}
        {{--var int_id = setInterval(tradeStatus,5000);--}}
        function tradeStatus()
        {
            $.post("{{route('pay.payment_status')}}",{'payment_id':payment_id},
                function(data)
                {
                    if(data.status == 1)
                    {
                        $('#msg_tip').html(data.msg+',正在跳转请稍后...');
                        $('#msg_tip').css('display','block');
                        setTimeout(function() {location.href = "{{route('users.dcoin_detail', ['id' => $user->id])}}";}, 2 * 1000);
                    }
                });
        }
        function make_qr_img(purl,id)
        {
            $.post(purl,
                function(data)
                {
                    $('#qr_img').attr('src',data.qr_img);
                    $('#qr_price').html('赞助 '+ data.price + ' 元');
                    clearInterval(int_id);
                    payment_id = data.payment_id;
                    setInterval(tradeStatus,5000);
                });
		    
			$('.dcoin_price').css({"background-color":"#c9daf8","color":"#000"});	
			$('#'+id).css({"background-color":"#86ADD4","color":"#fff"});

        }
    </script>
@stop
